package my.app1.service

import grails.gorm.transactions.Transactional
import my.app1.domain.SomeTest
import org.slf4j.Logger
import org.slf4j.LoggerFactory

import javax.inject.Singleton

@Singleton
@Transactional
class HelloService {
    private static Logger log = LoggerFactory.getLogger(HelloService.class)

    void addSomeTest(){
        SomeTest someTest=new SomeTest()
        someTest.id=0
        someTest.name="hello"
        if(!someTest.save(flush:true)){
            log.error("保存数据到数据库出错：",someTest.getErrors())
        }
    }

    List<SomeTest> findAllSomeTest(){
       return SomeTest.findAll()
    }
}
